\section{sylv --- solution of Sylvester Equation}
\label{fn:sylv}
\index{sylv()}
\index{Lyapunov equation}
\index{Sylvester equation}
\begin{rail}
Sylv : 'sylv' '(' ( Matrix ( () | ','  Matrix) ',' Matrix ) ')' ;
\end{rail}

\verb+sylv+ is a Sylvester equation solver.  Given the first matrix
argument is $A$, the second matrix argument is $B$, and the third
matrix argument is $C$, \verb+sylv+ solves 

\begin{displaymath}
Ax + xB = -C
\end{displaymath}

for $x$.  If there are only two arguments,  it is assumed
$B = A^{T}$, and the Lyapunov equation is solved.

The matrix arguments must both be upper triangular.  If they are not,
the \verb+lyap+ function implements a wrapper over this function
that performs suitable Schur decomposition.

\paragraph{Example}
\index{example of sylv()}
\index{sylv()!example}
\begin{verbatim}
> a = triu(rand(4,4))
 a =
    0.807      0.253      0.216      0.762  
        0      0.339     0.0222      0.717  
        0          0      0.356     0.0606  
        0          0          0       0.78  
> b = triu(rand(4,4))
 b =
    0.324      0.156       0.37      0.743  
        0      0.133       0.81      0.705  
        0          0      0.909      0.621  
        0          0          0      0.845
> c = diag(rand(1,4))
 c =
    0.845          0          0          0  
        0      0.401          0          0  
        0          0      0.341          0  
        0          0          0      0.623  
> x = sylv(a,b,c)
 x =
   -0.747      0.353    -0.0535      0.294  
       -0     -0.849      0.556      0.443  
       -0         -0      -0.27      0.159  
       -0         -0         -0     -0.383  
> a*x+x*b + c
-1.11e-16  -5.55e-17          0  -5.55e-17  
        0          0   5.55e-17          0  
        0          0          0          0  
        0          0          0          0 
\end{verbatim}

See also: Page~\pageref{fn:lyap} \verb+lyap()+,
Page~\pageref{fn:schur} \verb+schur()+.

\newpage



